package com.dingli.controller;

import com.dingli.framework.entity.Member;
import com.dingli.framework.entity.Role;
import com.dingli.framework.entity.User;
import com.dingli.framework.util.Response;
import com.dingli.service.IMemberService;
import com.dingli.service.ISystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin("*")
@RestController
@RequestMapping("/login")
@Api(tags = "系统相关")
public class SystemController {

    @Autowired
    private ISystemService iSystemService;


    @GetMapping("/relogin")
    @ApiOperation("管理登录")
    public Response<Role> relogin(@ApiParam("账号") @RequestParam Long roleId,
                                @ApiParam("密码") @RequestParam String password) {
        return iSystemService.relogin(roleId, password);
    }

    @GetMapping("/MBlogin")
    @ApiOperation("会员登录")
    public Response<Member> MBlogin(@ApiParam("账号") @RequestParam Long mbID,
                                   @ApiParam("密码") @RequestParam String password) {
        return iSystemService.MBlogin(mbID, password);
    }
}
